package com.example.publisher;

import com.example.event.CustomEvent;
import com.example.event.GenericEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

@Component
public class StringEventPublisher {

    @Autowired
    private ApplicationEventPublisher stringEventPublisher;

    public void publishEvent(final String message) {
        GenericEvent<String> stringGenericEvent=new GenericEvent<String>(this,message);
        stringEventPublisher.publishEvent(stringGenericEvent);
    }
}